///@file ParametersBean.h
///@brief Beans declaration for all types of parameters list.
///@author A. Poliukhovych

#pragma once

#include <QVector>
#include <QString>
#include "Game.h"
#include "GameSettings.h"
#include "Map.h"


typedef QVector<QString> MessageParameters;

///@class ParametersBean
///@brief Parent class for all types of beans for parameter list. Also represents empty parameter list.
class ParametersBean
{
public:
    virtual MessageParameters ToList() const
    {
        return MessageParameters();
    }
    virtual ~ParametersBean() {}
};

typedef QSharedPointer<ParametersBean> ParametersPtr;

class PlayerIDBean : public ParametersBean
{
public:
    PlayerIDBean(int id);
    MessageParameters ToList() const;

    int PlayerId() const { return m_id; }
private:
    int m_id;
};

//unfinished
class TurnBean: public ParametersBean
{
public:
    TurnBean(Tank::TurnDirectionType action) :
        m_action(action)
    {}
    MessageParameters ToList() const
    {return MessageParameters();}

private:
    Tank::TurnDirectionType m_action;
};


class TurnRequestBean: public TurnBean
{
public:
    TurnRequestBean();
    MessageParameters ToList() const;

private:
};


class TurnActionBean: public TurnBean
{
public:
    TurnActionBean(int id);
    MessageParameters ToList() const;

private:
    int m_id;
};


class MessageBean : public ParametersBean
{
public:
    MessageBean(const QString& msg);
    MessageParameters ToList() const;

private:
    QString m_message;
};


class PlayerlistBean : public ParametersBean
{
public:
    typedef QList<Player> Playerlist;

    PlayerlistBean(const Playerlist& playerlist);
    MessageParameters ToList() const;

    Playerlist Players() const { return m_players; }

private:
    Playerlist m_players;
};


typedef QList< BulletPtr > Bullets;
typedef QList< TankPtr> Tanks;

class SnapshotBean : public ParametersBean
{
public:

    SnapshotBean(const Tanks& tanks, const Bullets& bullets);
    MessageParameters ToList() const;

    Tanks TankList() const { return m_snapshotTanks; }
    Bullets BulletList() const { return m_snapshotBullets; }

private:
   Tanks m_snapshotTanks;
   Bullets m_snapshotBullets;
};


class MapBean : public ParametersBean
{
public:
    MapBean(QSharedPointer<Map> map, const GameSettings& sets);
    MessageParameters ToList() const;

    QSharedPointer<Map> GetMap() const { return m_map; }
    GameSettings GetSettings() const { return m_settings; }
private:
   QSharedPointer<Map> m_map;
   GameSettings m_settings;
};

class TanksBean : public ParametersBean
{
public:
    TanksBean(QSharedPointer<Map> map, const GameSettings& sets);
    MessageParameters ToList() const;
private:
   QSharedPointer<Map> m_map;
   GameSettings m_settings;
};

